﻿myApp.controller("newsDetailController", function ($scope, $http, $modal, modalService, $routeParams, $location) {
    $scope.share = {};
    console.log('News Details');
    function pageInit() {
        var url = 'api/News/GetNew/' + $routeParams.id;
        $http.get(url).success(function (data) {
            $scope.News = data.MobileNews;
            $scope.News.CreateDate = new Date($scope.News.CreateDate);
            $scope.slides = data.pictureList;


            $scope.share.url = 'http://www.penangrealty.my/NewDetail/' + $routeParams.id.toString();
            $scope.share.pictureUrl = $scope.slides ? $scope.slides[0].pictureURL : 'http://www.penangrealty.my/images/penang realty,Apartment,house,condominium,terrace house,semi d,detached,bungalow,high end luxury properties,landed properties,gated guarded house.png';
            $scope.share.description = "[" + $scope.News.Title + '] ' + $scope.News.Source + " - " + $scope.News.CreateDate
    + '\n' + $scope.News.Details + '\n' + window.location.href + '\n';
            //+ "Contact: " + $scope.property.mobile + " (" + $scope.property.agentname + ")";
            document.title = "Penang Realty 世界地產 " + $scope.News.Title;
            $scope.$emit('newPageLoaded', { 'title': $scope.News.Title, 'description': $scope.News.Details });
        })
       
    }

    pageInit();
});